<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- Copyright 2016 TensorFlow authors.</span><span>
</span><span id="line-2"></span><span class="hs-comment">--</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- you may not use this file except in compliance with the License.</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- You may obtain a copy of the License at</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">--     http://www.apache.org/licenses/LICENSE-2.0</span><span>
</span><span id="line-8"></span><span class="hs-comment">--</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Unless required by applicable law or agreed to in writing, software</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- See the License for the specific language governing permissions and</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- limitations under the License.</span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span class="hs-comment">-- | This module contains definitions for some built-in TensorFlow operations.</span><span>
</span><span id="line-16"></span><span class="hs-comment">--</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- Note that certain, &quot;stateful&quot; ops like 'variable' and 'assign' return a</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- 'Build' action (e.g., @Build (Tensor Ref a)@ instead of a pure value; the</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- returned 'Tensor's are always rendered in the current 'Build' context.  This</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- approach helps us avoid problems with inlining or common subexpression</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- elimination, by writing</span><span>
</span><span id="line-22"></span><span class="hs-comment">--</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- &gt; do</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- &gt;     v &lt;- variable []</span><span>
</span><span id="line-25"></span><span class="hs-comment">-- &gt;     w &lt;- assign v 3</span><span>
</span><span id="line-26"></span><span class="hs-comment">-- &gt;     render $ w * w</span><span>
</span><span id="line-27"></span><span class="hs-comment">--</span><span>
</span><span id="line-28"></span><span class="hs-comment">-- instead of</span><span>
</span><span id="line-29"></span><span class="hs-comment">--</span><span>
</span><span id="line-30"></span><span class="hs-comment">-- &gt; let</span><span>
</span><span id="line-31"></span><span class="hs-comment">-- &gt;    v = variable []</span><span>
</span><span id="line-32"></span><span class="hs-comment">-- &gt;    w = assign v 3</span><span>
</span><span id="line-33"></span><span class="hs-comment">-- &gt; in w * w</span><span>
</span><span id="line-34"></span><span class="hs-comment">--</span><span>
</span><span id="line-35"></span><span class="hs-comment">-- since the latter could be reasonably transformed by the compiler into (or</span><span>
</span><span id="line-36"></span><span class="hs-comment">-- vice versa)</span><span>
</span><span id="line-37"></span><span class="hs-comment">--</span><span>
</span><span id="line-38"></span><span class="hs-comment">-- &gt; let</span><span>
</span><span id="line-39"></span><span class="hs-comment">-- &gt;    v = variable []</span><span>
</span><span id="line-40"></span><span class="hs-comment">-- &gt;    w = assign v 3</span><span>
</span><span id="line-41"></span><span class="hs-comment">-- &gt;    w' = assign v 3</span><span>
</span><span id="line-42"></span><span class="hs-comment">-- &gt; in w * w'</span><span>
</span><span id="line-43"></span><span class="hs-comment">--</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- Ops should return a 'Build' action if their original 'OpDef' marks them as</span><span>
</span><span id="line-45"></span><span class="hs-comment">-- stateful, or if they take any Refs as input.  (This mirrors the rules that</span><span>
</span><span id="line-46"></span><span class="hs-comment">-- TensorFlow uses to avoid common subexpression elimination.)</span><span>
</span><span id="line-47"></span><span class="hs-pragma">{-# LANGUAGE ConstraintKinds #-}</span><span>
</span><span id="line-48"></span><span class="hs-pragma">{-# LANGUAGE DataKinds #-}</span><span>
</span><span id="line-49"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-50"></span><span class="hs-pragma">{-# LANGUAGE FlexibleInstances #-}</span><span>
</span><span id="line-51"></span><span class="hs-pragma">{-# LANGUAGE OverloadedLists #-}</span><span>
</span><span id="line-52"></span><span class="hs-pragma">{-# LANGUAGE OverloadedStrings #-}</span><span>
</span><span id="line-53"></span><span class="hs-pragma">{-# LANGUAGE RankNTypes #-}</span><span>
</span><span id="line-54"></span><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
</span><span id="line-55"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-56"></span><span class="hs-pragma">{-# LANGUAGE UndecidableInstances #-}</span><span>
</span><span id="line-57"></span><span class="hs-pragma">{-# OPTIONS_GHC -fno-warn-orphans #-}</span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">TensorFlow.Ops</span><span>
</span><span id="line-60"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.add</span></span><span>
</span><span id="line-61"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.add'</span></span><span>
</span><span id="line-62"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.abs</span></span><span>
</span><span id="line-63"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.abs'</span></span><span>
</span><span id="line-64"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.addN</span></span><span>
</span><span id="line-65"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.addN'</span></span><span>
</span><span id="line-66"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.argMax</span></span><span>
</span><span id="line-67"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.argMax'</span></span><span>
</span><span id="line-68"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.assign</span></span><span>
</span><span id="line-69"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.assign'</span></span><span>
</span><span id="line-70"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.broadcastGradientArgs</span></span><span>
</span><span id="line-71"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.broadcastGradientArgs'</span></span><span>
</span><span id="line-72"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.cast</span></span><span>
</span><span id="line-73"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.cast'</span></span><span>
</span><span id="line-74"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.concat</span></span><span>
</span><span id="line-75"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.concat'</span></span><span>
</span><span id="line-76"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#constant"><span class="hs-identifier">constant</span></a></span><span>
</span><span id="line-77"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#constant%27"><span class="hs-identifier">constant'</span></a></span><span>
</span><span id="line-78"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.equal</span></span><span>
</span><span id="line-79"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.equal'</span></span><span>
</span><span id="line-80"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#expandDims"><span class="hs-identifier">expandDims</span></a></span><span>
</span><span id="line-81"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#expandDims%27"><span class="hs-identifier">expandDims'</span></a></span><span>
</span><span id="line-82"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#initializedVariable"><span class="hs-identifier">initializedVariable</span></a></span><span>
</span><span id="line-83"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#initializedVariable%27"><span class="hs-identifier">initializedVariable'</span></a></span><span>
</span><span id="line-84"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#zeroInitializedVariable"><span class="hs-identifier">zeroInitializedVariable</span></a></span><span>
</span><span id="line-85"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#zeroInitializedVariable%27"><span class="hs-identifier">zeroInitializedVariable'</span></a></span><span>
</span><span id="line-86"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.fill</span></span><span>
</span><span id="line-87"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.fill'</span></span><span>
</span><span id="line-88"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.identity</span></span><span>
</span><span id="line-89"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.identity'</span></span><span>
</span><span id="line-90"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.matMul</span></span><span>
</span><span id="line-91"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.matMul'</span></span><span>
</span><span id="line-92"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.einsum</span></span><span>
</span><span id="line-93"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.einsum'</span></span><span>
</span><span id="line-94"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#matTranspose"><span class="hs-identifier">matTranspose</span></a></span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#matTranspose%27"><span class="hs-identifier">matTranspose'</span></a></span><span>
</span><span id="line-96"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.mean</span></span><span>
</span><span id="line-97"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.mean'</span></span><span>
</span><span id="line-98"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.mul</span></span><span>
</span><span id="line-99"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.mul'</span></span><span>
</span><span id="line-100"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.neg</span></span><span>
</span><span id="line-101"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.neg'</span></span><span>
</span><span id="line-102"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.oneHot</span></span><span>
</span><span id="line-103"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.oneHot'</span></span><span>
</span><span id="line-104"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.pack</span></span><span>
</span><span id="line-105"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.pack'</span></span><span>
</span><span id="line-106"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#placeholder"><span class="hs-identifier">placeholder</span></a></span><span>
</span><span id="line-107"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#placeholder%27"><span class="hs-identifier">placeholder'</span></a></span><span>
</span><span id="line-108"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.range</span></span><span>
</span><span id="line-109"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.range'</span></span><span>
</span><span id="line-110"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#reducedShape"><span class="hs-identifier">reducedShape</span></a></span><span>
</span><span id="line-111"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#reduceMean"><span class="hs-identifier">reduceMean</span></a></span><span>
</span><span id="line-112"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#reduceMean%27"><span class="hs-identifier">reduceMean'</span></a></span><span>
</span><span id="line-113"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.relu</span></span><span>
</span><span id="line-114"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.relu'</span></span><span>
</span><span id="line-115"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.reluGrad</span></span><span>
</span><span id="line-116"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.reluGrad'</span></span><span>
</span><span id="line-117"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.tanh</span></span><span>
</span><span id="line-118"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.tanhGrad</span></span><span>
</span><span id="line-119"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.reshape</span></span><span>
</span><span id="line-120"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.reshape'</span></span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#restore"><span class="hs-identifier">restore</span></a></span><span>
</span><span id="line-122"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#restoreFromName"><span class="hs-identifier">restoreFromName</span></a></span><span>
</span><span id="line-123"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#save"><span class="hs-identifier">save</span></a></span><span>
</span><span id="line-124"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#scalar"><span class="hs-identifier">scalar</span></a></span><span>
</span><span id="line-125"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#scalar%27"><span class="hs-identifier">scalar'</span></a></span><span>
</span><span id="line-126"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#shape"><span class="hs-identifier">shape</span></a></span><span>
</span><span id="line-127"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#shape%27"><span class="hs-identifier">shape'</span></a></span><span>
</span><span id="line-128"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.sigmoid</span></span><span>
</span><span id="line-129"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.sigmoidGrad</span></span><span>
</span><span id="line-130"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.sign</span></span><span>
</span><span id="line-131"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.sign'</span></span><span>
</span><span id="line-132"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.size</span></span><span>
</span><span id="line-133"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.size'</span></span><span>
</span><span id="line-134"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.softmax</span></span><span>
</span><span id="line-135"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.softmax'</span></span><span>
</span><span id="line-136"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.softmaxCrossEntropyWithLogits</span></span><span>
</span><span id="line-137"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.softmaxCrossEntropyWithLogits'</span></span><span>
</span><span id="line-138"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.sparseToDense</span></span><span>
</span><span id="line-139"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.sparseToDense'</span></span><span>
</span><span id="line-140"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.sub</span></span><span>
</span><span id="line-141"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.sub'</span></span><span>
</span><span id="line-142"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.sum</span></span><span>
</span><span id="line-143"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.sum'</span></span><span>
</span><span id="line-144"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#reduceSum"><span class="hs-identifier">reduceSum</span></a></span><span>
</span><span id="line-145"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#reduceSum%27"><span class="hs-identifier">reduceSum'</span></a></span><span>
</span><span id="line-146"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.transpose</span></span><span>
</span><span id="line-147"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.transpose'</span></span><span>
</span><span id="line-148"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#truncatedNormal"><span class="hs-identifier">truncatedNormal</span></a></span><span>
</span><span id="line-149"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#truncatedNormal%27"><span class="hs-identifier">truncatedNormal'</span></a></span><span>
</span><span id="line-150"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.variable</span></span><span>
</span><span id="line-151"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.variable'</span></span><span>
</span><span id="line-152"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#vector"><span class="hs-identifier">vector</span></a></span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#vector%27"><span class="hs-identifier">vector'</span></a></span><span>
</span><span id="line-154"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#zeros"><span class="hs-identifier">zeros</span></a></span><span>
</span><span id="line-155"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.zerosLike</span></span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps.zerosLike'</span></span><span>
</span><span id="line-157"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html#scalarize"><span class="hs-identifier">scalarize</span></a></span><span>
</span><span id="line-158"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.ByteString</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">ByteString</span></span><span class="hs-special">)</span><span>
</span><span id="line-161"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Complex</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Complex</span></span><span class="hs-special">)</span><span>
</span><span id="line-162"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Int</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Int32</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">Int64</span></span><span class="hs-special">)</span><span>
</span><span id="line-163"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Word</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Word16</span></span><span class="hs-special">)</span><span>
</span><span id="line-164"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Prelude</span></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">abs</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">sum</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">concat</span></span><span class="hs-special">)</span><span>
</span><span id="line-165"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.ProtoLens.Default</span></span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">def</span></span><span class="hs-special">)</span><span>
</span><span id="line-166"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Text.Encoding</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">encodeUtf8</span></span><span class="hs-special">)</span><span>
</span><span id="line-167"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Lens.Family2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-operator">(.~)</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-operator">(&amp;)</span></span><span class="hs-special">)</span><span>
</span><span id="line-168"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Text.Printf</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">printf</span></span><span class="hs-special">)</span><span>
</span><span id="line-169"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.Tensor</span></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">TensorProto</span></span><span class="hs-special">)</span><span>
</span><span id="line-170"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.Tensor_Fields</span></span><span>
</span><span id="line-171"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier">dtype</span></span><span>
</span><span id="line-172"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">tensorShape</span></span><span>
</span><span id="line-173"></span><span>    </span><span class="hs-special">)</span><span>
</span><span id="line-174"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.TensorShape_Fields</span></span><span>
</span><span id="line-175"></span><span>  </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">TensorShape</span></span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.Build</span></span><span>
</span><span id="line-178"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.BuildOp</span></span><span>
</span><span id="line-179"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.ControlFlow</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">group</span></span><span class="hs-special">)</span><span>
</span><span id="line-180"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.Tensor</span></span><span>
</span><span id="line-181"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.Types</span></span><span>
</span><span id="line-182"></span><span>
</span><span id="line-183"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.GenOps.Core</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps</span></span><span>
</span><span id="line-184"></span><span>
</span><span id="line-185"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Prelude</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">abs</span></span><span class="hs-special">)</span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span class="hs-comment">-- TODO: Look into hs-boot refactoring to allow mutually recursive imports.</span><span>
</span><span id="line-188"></span><span class="hs-comment">-- | Must be defined as an orphan because of the dependency order between Ops</span><span>
</span><span id="line-189"></span><span class="hs-comment">-- and Tensor.</span><span>
</span><span id="line-190"></span><span class="hs-comment">--</span><span>
</span><span id="line-191"></span><span class="hs-comment">-- The indirect constraint &quot;v ~ Value&quot; helps disambiguate types, for example in</span><span>
</span><span id="line-192"></span><span class="hs-comment">-- &quot;neg 1 :: Tensor Value Float&quot;, it helps find the type of the subexpression</span><span>
</span><span id="line-193"></span><span class="hs-comment">-- &quot;1&quot;.</span><span>
</span><span id="line-194"></span><span id="local-6989586621679155967"><span id="local-6989586621679155968"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155968"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-195"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Num</span></span><span> </span><span class="annot"><a href="#local-6989586621679155968"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-196"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679155967"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><span class="hs-glyph hs-type">~</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span>
</span><span id="line-197"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OneOf</span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span>
</span><span id="line-198"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">]</span><span> </span><span class="annot"><a href="#local-6989586621679155968"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Num</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155967"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155968"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-199"></span><span>    </span><span id="local-6989586621679155958"><span class="annot"><span class="annottext">+ :: Tensor v a -&gt; Tensor v a -&gt; Tensor v a
</span><span class="hs-operator hs-var hs-var hs-var hs-var">(+)</span></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor v a -&gt; Tensor v a
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t.
OneOf
  '[Complex Double, Complex Float, ByteString, Int16, Int32, Int64,
    Int8, Word16, Word8, Double, Float]
  t =&gt;
Tensor v'1 t -&gt; Tensor v'2 t -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.add</span></span><span>
</span><span id="line-200"></span><span>    </span><span id="local-6989586621679155956"><span class="annot"><span class="annottext">* :: Tensor v a -&gt; Tensor v a -&gt; Tensor v a
</span><span class="hs-operator hs-var hs-var hs-var hs-var">(*)</span></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor v a -&gt; Tensor v a
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t.
OneOf
  '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16,
    Word8, Double, Float]
  t =&gt;
Tensor v'1 t -&gt; Tensor v'2 t -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.mul</span></span><span>
</span><span id="line-201"></span><span>    </span><span id="local-6989586621679155954"><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="hs-special">)</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor v a -&gt; Tensor v a
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t.
OneOf
  '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16,
    Word32, Word8, Double, Float]
  t =&gt;
Tensor v'1 t -&gt; Tensor v'2 t -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.sub</span></span><span>
</span><span id="line-202"></span><span>    </span><span id="local-6989586621679155953"><span class="annot"><span class="annottext">abs :: Tensor v a -&gt; Tensor v a
</span><a href="#local-6989586621679155953"><span class="hs-identifier hs-var hs-var hs-var hs-var">abs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor v a
forall (v'1 :: * -&gt; *) t.
OneOf '[Int16, Int32, Int64, Int8, Word16, Double, Float] t =&gt;
Tensor v'1 t -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.abs</span></span><span>
</span><span id="line-203"></span><span>    </span><span id="local-6989586621679155952"><span class="annot"><span class="annottext">fromInteger :: Integer -&gt; Tensor v a
</span><span class="hs-identifier hs-var hs-var hs-var hs-var">fromInteger</span></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Tensor Build a
forall a. TensorType a =&gt; a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#scalar"><span class="hs-identifier hs-var">scalar</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Tensor Build a)
-&gt; (Integer -&gt; a) -&gt; Integer -&gt; Tensor Build a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a
forall a. Num a =&gt; Integer -&gt; a
</span><span class="hs-identifier hs-var">fromInteger</span></span><span>
</span><span id="line-204"></span><span>    </span><span id="local-6989586621679155950"><span class="annot"><span class="annottext">signum :: Tensor v a -&gt; Tensor v a
</span><span class="hs-identifier hs-var hs-var hs-var hs-var">signum</span></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor v a
forall (v'1 :: * -&gt; *) t.
OneOf
  '[Complex Double, Complex Float, Int32, Int64, Word16, Double,
    Float]
  t =&gt;
Tensor v'1 t -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.sign</span></span><span>
</span><span id="line-205"></span><span>    </span><span id="local-6989586621679155948"><span class="annot"><span class="annottext">negate :: Tensor v a -&gt; Tensor v a
</span><span class="hs-identifier hs-var hs-var hs-var hs-var">negate</span></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor v a
forall (v'1 :: * -&gt; *) t.
OneOf
  '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16,
    Double, Float]
  t =&gt;
Tensor v'1 t -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.neg</span></span></span></span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span id="local-6989586621679155946"><span id="local-6989586621679155947"><span class="annot"><a href="TensorFlow.Ops.html#matTranspose"><span class="hs-identifier hs-type">matTranspose</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155947"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155946"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155947"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679155947"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-208"></span><span id="matTranspose"><span class="annot"><span class="annottext">matTranspose :: Tensor e a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#matTranspose"><span class="hs-identifier hs-var hs-var">matTranspose</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor e a -&gt; Tensor Build a
forall a (v :: * -&gt; *).
TensorType a =&gt;
OpParams -&gt; Tensor v a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#matTranspose%27"><span class="hs-identifier hs-var">matTranspose'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-209"></span><span>
</span><span id="line-210"></span><span id="local-6989586621679156314"><span id="local-6989586621679156315"><span class="annot"><a href="TensorFlow.Ops.html#matTranspose%27"><span class="hs-identifier hs-type">matTranspose'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156315"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679156314"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679156315"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679156315"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-211"></span><span id="matTranspose%27"><span class="annot"><span class="annottext">matTranspose' :: OpParams -&gt; Tensor v a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#matTranspose%27"><span class="hs-identifier hs-var hs-var">matTranspose'</span></a></span></span><span> </span><span id="local-6989586621679155944"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679155944"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Tensor v a -&gt; Tensor Build Int32 -&gt; Tensor Build a)
-&gt; Tensor Build Int32 -&gt; Tensor v a -&gt; Tensor Build a
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><span class="hs-identifier hs-var">flip</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OpParams -&gt; Tensor v a -&gt; Tensor Build Int32 -&gt; Tensor Build a
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t tperm.
(TensorType t, OneOf '[Int32, Int64] tperm) =&gt;
OpParams -&gt; Tensor v'1 t -&gt; Tensor v'2 tperm -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.transpose'</span></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679155944"><span class="hs-identifier hs-var">params</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Int32] -&gt; Tensor Build Int32
forall a. TensorType a =&gt; [a] -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#vector"><span class="hs-identifier hs-var">vector</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-number">1</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span id="local-6989586621679155941"><span id="local-6989586621679155942"><span class="annot"><a href="TensorFlow.Ops.html#placeholder"><span class="hs-identifier hs-type">placeholder</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679155942"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155941"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679155942"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Value</span></span><span> </span><span class="annot"><a href="#local-6989586621679155941"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-214"></span><span id="placeholder"><span class="annot"><span class="annottext">placeholder :: Shape -&gt; m (Tensor Value a)
</span><a href="TensorFlow.Ops.html#placeholder"><span class="hs-identifier hs-var hs-var">placeholder</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Shape -&gt; m (Tensor Value a)
forall (m :: * -&gt; *) a.
(MonadBuild m, TensorType a) =&gt;
OpParams -&gt; Shape -&gt; m (Tensor Value a)
</span><a href="TensorFlow.Ops.html#placeholder%27"><span class="hs-identifier hs-var">placeholder'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-215"></span><span>
</span><span id="line-216"></span><span class="annot"><a href="TensorFlow.Ops.html#placeholder%27"><span class="hs-identifier hs-type">placeholder'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679156297"><span class="annot"><a href="#local-6989586621679156297"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621679156295"><span class="annot"><a href="#local-6989586621679156295"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679156297"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156295"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-217"></span><span>             </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679156297"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Value</span></span><span> </span><span class="annot"><a href="#local-6989586621679156295"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-218"></span><span id="placeholder%27"><span class="annot"><span class="annottext">placeholder' :: OpParams -&gt; Shape -&gt; m (Tensor Value a)
</span><a href="TensorFlow.Ops.html#placeholder%27"><span class="hs-identifier hs-var hs-var">placeholder'</span></a></span></span><span> </span><span id="local-6989586621679155940"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679155940"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span id="local-6989586621679155939"><span class="annot"><span class="annottext">pShape :: Shape
</span><a href="#local-6989586621679155939"><span class="hs-identifier hs-var">pShape</span></a></span></span><span>
</span><span id="line-219"></span><span>    </span><span class="hs-comment">-- Note: we don't use CoreOps.placeholder' since that op isn't stateful,</span><span>
</span><span id="line-220"></span><span>    </span><span class="hs-comment">-- and thus would be CSE'd.</span><span>
</span><span id="line-221"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Build (Tensor Value a) -&gt; m (Tensor Value a)
forall (m :: * -&gt; *) a. MonadBuild m =&gt; Build a -&gt; m a
</span><span class="hs-identifier hs-var">build</span></span><span> </span><span class="annot"><span class="annottext">(Build (Tensor Value a) -&gt; m (Tensor Value a))
-&gt; Build (Tensor Value a) -&gt; m (Tensor Value a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; OpDef -&gt; Build (Tensor Value a)
forall a. BuildResult a =&gt; [Int64] -&gt; OpDef -&gt; Build a
</span><span class="hs-identifier hs-var">buildOp</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(OpDef -&gt; Build (Tensor Value a))
-&gt; OpDef -&gt; Build (Tensor Value a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">OpType -&gt; OpDef
</span><span class="hs-identifier hs-var">opDef</span></span><span> </span><span class="annot"><span class="hs-string">&quot;Placeholder&quot;</span></span><span>
</span><span id="line-222"></span><span>                </span><span class="annot"><span class="annottext">OpDef -&gt; OpParams -&gt; OpDef
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Lens' OpDef DataType
forall a. Attribute a =&gt; Text -&gt; Lens' OpDef a
</span><span class="hs-identifier hs-var">opAttr</span></span><span> </span><span class="annot"><span class="hs-string">&quot;dtype&quot;</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef DataType)
-&gt; DataType -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; DataType
forall a. TensorType a =&gt; a -&gt; DataType
</span><span class="hs-identifier hs-var">tensorType</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. HasCallStack =&gt; a
</span><span class="hs-identifier hs-var">undefined</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679156295"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-223"></span><span>                </span><span class="annot"><span class="annottext">OpDef -&gt; OpParams -&gt; OpDef
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Lens' OpDef Shape
forall a. Attribute a =&gt; Text -&gt; Lens' OpDef a
</span><span class="hs-identifier hs-var">opAttr</span></span><span> </span><span class="annot"><span class="hs-string">&quot;shape&quot;</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef Shape)
-&gt; Shape -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">Shape
</span><a href="#local-6989586621679155939"><span class="hs-identifier hs-var">pShape</span></a></span><span>
</span><span id="line-224"></span><span>                </span><span class="annot"><span class="annottext">OpDef -&gt; OpParams -&gt; OpDef
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679155940"><span class="hs-identifier hs-var">params</span></a></span><span>
</span><span id="line-225"></span><span>
</span><span id="line-226"></span><span class="hs-comment">-- | Creates a variable initialized to the given value.</span><span>
</span><span id="line-227"></span><span class="hs-comment">-- Initialization happens next time session runs.</span><span>
</span><span id="line-228"></span><span id="local-6989586621679155930"><span id="local-6989586621679155931"><span id="local-6989586621679155932"><span class="annot"><a href="TensorFlow.Ops.html#initializedVariable"><span class="hs-identifier hs-type">initializedVariable</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679155932"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155931"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-229"></span><span>                    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155930"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155931"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679155932"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ref</span></span><span> </span><span class="annot"><a href="#local-6989586621679155931"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-230"></span><span id="initializedVariable"><span class="annot"><span class="annottext">initializedVariable :: Tensor v a -&gt; m (Tensor Ref a)
</span><a href="TensorFlow.Ops.html#initializedVariable"><span class="hs-identifier hs-var hs-var">initializedVariable</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor v a -&gt; m (Tensor Ref a)
forall (m :: * -&gt; *) a (v :: * -&gt; *).
(MonadBuild m, TensorType a) =&gt;
OpParams -&gt; Tensor v a -&gt; m (Tensor Ref a)
</span><a href="TensorFlow.Ops.html#initializedVariable%27"><span class="hs-identifier hs-var">initializedVariable'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-231"></span><span>
</span><span id="line-232"></span><span id="local-6989586621679156257"><span id="local-6989586621679156258"><span id="local-6989586621679156259"><span class="annot"><a href="TensorFlow.Ops.html#initializedVariable%27"><span class="hs-identifier hs-type">initializedVariable'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679156259"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156258"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-233"></span><span>                    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679156257"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679156258"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679156259"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ref</span></span><span> </span><span class="annot"><a href="#local-6989586621679156258"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-234"></span><span id="initializedVariable%27"><span class="annot"><span class="annottext">initializedVariable' :: OpParams -&gt; Tensor v a -&gt; m (Tensor Ref a)
</span><a href="TensorFlow.Ops.html#initializedVariable%27"><span class="hs-identifier hs-var hs-var">initializedVariable'</span></a></span></span><span> </span><span id="local-6989586621679155929"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679155929"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span id="local-6989586621679155928"><span class="annot"><span class="annottext">initializer :: Tensor v a
</span><a href="#local-6989586621679155928"><span class="hs-identifier hs-var">initializer</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-235"></span><span>    </span><span id="local-6989586621679155927"><span class="annot"><span class="annottext">Tensor Ref a
</span><a href="#local-6989586621679155927"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Shape -&gt; m (Tensor Ref a)
forall dtype (m' :: * -&gt; *).
(MonadBuild m', TensorType dtype) =&gt;
OpParams -&gt; Shape -&gt; m' (Tensor Ref dtype)
</span><span class="hs-identifier hs-var">CoreOps.variable'</span></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679155929"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- The shape is not known initially.</span><span>
</span><span id="line-236"></span><span>    </span><span id="local-6989586621679155926"><span class="annot"><span class="annottext">Tensor Ref a
</span><a href="#local-6989586621679155926"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor Ref a -&gt; Tensor v a -&gt; m (Tensor Ref a)
forall (v'2 :: * -&gt; *) t (m' :: * -&gt; *).
(MonadBuild m', TensorType t) =&gt;
OpParams -&gt; Tensor Ref t -&gt; Tensor v'2 t -&gt; m' (Tensor Ref t)
</span><span class="hs-identifier hs-var">CoreOps.assign'</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Lens' OpDef Bool
forall a. Attribute a =&gt; Text -&gt; Lens' OpDef a
</span><span class="hs-identifier hs-var">opAttr</span></span><span> </span><span class="annot"><span class="hs-string">&quot;validate_shape&quot;</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef Bool)
-&gt; Bool -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Tensor Ref a
</span><a href="#local-6989586621679155927"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-237"></span><span>                            </span><span class="annot"><span class="annottext">Tensor v a
</span><a href="#local-6989586621679155928"><span class="hs-identifier hs-var">initializer</span></a></span><span>
</span><span id="line-238"></span><span>    </span><span class="annot"><span class="annottext">ControlNode -&gt; m ()
forall (m :: * -&gt; *). MonadBuild m =&gt; ControlNode -&gt; m ()
</span><span class="hs-identifier hs-var">addInitializer</span></span><span> </span><span class="annot"><span class="annottext">(ControlNode -&gt; m ()) -&gt; m ControlNode -&gt; m ()
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><span class="hs-operator hs-var">=&lt;&lt;</span></span><span> </span><span class="annot"><span class="annottext">Tensor Ref a -&gt; m ControlNode
forall (m :: * -&gt; *) t.
(MonadBuild m, Nodes t) =&gt;
t -&gt; m ControlNode
</span><span class="hs-identifier hs-var">group</span></span><span> </span><span class="annot"><span class="annottext">Tensor Ref a
</span><a href="#local-6989586621679155926"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-239"></span><span>    </span><span class="annot"><span class="annottext">Tensor Ref a -&gt; m (Tensor Ref a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><span class="hs-identifier hs-var">return</span></span><span> </span><span class="annot"><span class="annottext">Tensor Ref a
</span><a href="#local-6989586621679155927"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-240"></span><span>
</span><span id="line-241"></span><span class="hs-comment">-- | Creates a zero-initialized variable with the given shape.</span><span>
</span><span id="line-242"></span><span id="local-6989586621679155922"><span id="local-6989586621679155923"><span class="annot"><a href="TensorFlow.Ops.html#zeroInitializedVariable"><span class="hs-identifier hs-type">zeroInitializedVariable</span></a></span><span>
</span><span id="line-243"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679155923"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155922"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Num</span></span><span> </span><span class="annot"><a href="#local-6989586621679155922"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
</span><span id="line-244"></span><span>     </span><span class="annot"><span class="hs-identifier hs-type">TensorFlow.Types.Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679155923"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorFlow.Tensor.Ref</span></span><span> </span><span class="annot"><a href="#local-6989586621679155922"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-245"></span><span id="zeroInitializedVariable"><span class="annot"><span class="annottext">zeroInitializedVariable :: Shape -&gt; m (Tensor Ref a)
</span><a href="TensorFlow.Ops.html#zeroInitializedVariable"><span class="hs-identifier hs-var hs-var">zeroInitializedVariable</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Shape -&gt; m (Tensor Ref a)
forall (m :: * -&gt; *) a.
(MonadBuild m, TensorType a, Num a) =&gt;
OpParams -&gt; Shape -&gt; m (Tensor Ref a)
</span><a href="TensorFlow.Ops.html#zeroInitializedVariable%27"><span class="hs-identifier hs-var">zeroInitializedVariable'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-246"></span><span>
</span><span id="line-247"></span><span id="local-6989586621679156234"><span id="local-6989586621679156235"><span class="annot"><a href="TensorFlow.Ops.html#zeroInitializedVariable%27"><span class="hs-identifier hs-type">zeroInitializedVariable'</span></a></span><span>
</span><span id="line-248"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679156235"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156234"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Num</span></span><span> </span><span class="annot"><a href="#local-6989586621679156234"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
</span><span id="line-249"></span><span>     </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorFlow.Types.Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679156235"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorFlow.Tensor.Ref</span></span><span> </span><span class="annot"><a href="#local-6989586621679156234"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-250"></span><span id="zeroInitializedVariable%27"><span class="annot"><span class="annottext">zeroInitializedVariable' :: OpParams -&gt; Shape -&gt; m (Tensor Ref a)
</span><a href="TensorFlow.Ops.html#zeroInitializedVariable%27"><span class="hs-identifier hs-var hs-var">zeroInitializedVariable'</span></a></span></span><span> </span><span id="local-6989586621679155921"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679155921"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor Build a -&gt; m (Tensor Ref a)
forall (m :: * -&gt; *) a (v :: * -&gt; *).
(MonadBuild m, TensorType a) =&gt;
OpParams -&gt; Tensor v a -&gt; m (Tensor Ref a)
</span><a href="TensorFlow.Ops.html#initializedVariable%27"><span class="hs-identifier hs-var">initializedVariable'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679155921"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="annot"><span class="annottext">(Tensor Build a -&gt; m (Tensor Ref a))
-&gt; (Shape -&gt; Tensor Build a) -&gt; Shape -&gt; m (Tensor Ref a)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Tensor Build a
forall a. (Num a, TensorType a) =&gt; Shape -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#zeros"><span class="hs-identifier hs-var">zeros</span></a></span><span>
</span><span id="line-251"></span><span>
</span><span id="line-252"></span><span class="hs-comment">-- TODO: Support heterogeneous list of tensors.</span><span>
</span><span id="line-253"></span><span class="annot"><a href="TensorFlow.Ops.html#save"><span class="hs-identifier hs-type">save</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679155920"><span class="annot"><a href="#local-6989586621679155920"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621679155919"><span class="annot"><a href="#local-6989586621679155919"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621679155918"><span class="annot"><a href="#local-6989586621679155918"><span class="hs-identifier hs-type">v</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Rendered</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155918"><span class="hs-identifier hs-type">v</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679155919"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155920"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-254"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span>    </span><span class="hs-comment">-- ^ File path.</span><span>
</span><span id="line-255"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155918"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155920"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- ^ Tensors to save.</span><span>
</span><span id="line-256"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679155919"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ControlNode</span></span><span>
</span><span id="line-257"></span><span id="save"><span class="annot"><span class="annottext">save :: ByteString -&gt; [Tensor v a] -&gt; m ControlNode
</span><a href="TensorFlow.Ops.html#save"><span class="hs-identifier hs-var hs-var">save</span></a></span></span><span> </span><span id="local-6989586621679155917"><span class="annot"><span class="annottext">path :: ByteString
</span><a href="#local-6989586621679155917"><span class="hs-identifier hs-var">path</span></a></span></span><span> </span><span id="local-6989586621679155916"><span class="annot"><span class="annottext">xs :: [Tensor v a]
</span><a href="#local-6989586621679155916"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Build ControlNode -&gt; m ControlNode
forall (m :: * -&gt; *) a. MonadBuild m =&gt; Build a -&gt; m a
</span><span class="hs-identifier hs-var">build</span></span><span> </span><span class="annot"><span class="annottext">(Build ControlNode -&gt; m ControlNode)
-&gt; Build ControlNode -&gt; m ControlNode
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-258"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679155915"><span class="annot"><span class="annottext">toByteStringTensor :: Tensor v a -&gt; Tensor Build ByteString
</span><a href="#local-6989586621679155915"><span class="hs-identifier hs-var hs-var">toByteStringTensor</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Tensor Build ByteString
forall a. TensorType a =&gt; a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#scalar"><span class="hs-identifier hs-var">scalar</span></a></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; Tensor Build ByteString)
-&gt; (Tensor v a -&gt; ByteString)
-&gt; Tensor v a
-&gt; Tensor Build ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; ByteString
</span><span class="hs-identifier hs-var">encodeUtf8</span></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; ByteString)
-&gt; (Tensor v a -&gt; Text) -&gt; Tensor v a -&gt; ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Output -&gt; Text
</span><span class="hs-identifier hs-var">encodeOutput</span></span><span> </span><span class="annot"><span class="annottext">(Output -&gt; Text) -&gt; (Tensor v a -&gt; Output) -&gt; Tensor v a -&gt; Text
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Tensor v a -&gt; Output
forall (t :: * -&gt; *) a. Rendered t =&gt; t a -&gt; Output
</span><span class="hs-identifier hs-var">renderedOutput</span></span><span>
</span><span id="line-259"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679155912"><span class="annot"><span class="annottext">names :: [Tensor Build ByteString]
</span><a href="#local-6989586621679155912"><span class="hs-identifier hs-var hs-var">names</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Tensor v a -&gt; Tensor Build ByteString)
-&gt; [Tensor v a] -&gt; [Tensor Build ByteString]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><span class="hs-identifier hs-var">fmap</span></span><span> </span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor Build ByteString
forall a. Tensor v a -&gt; Tensor Build ByteString
</span><a href="#local-6989586621679155915"><span class="hs-identifier hs-var">toByteStringTensor</span></a></span><span> </span><span class="annot"><span class="annottext">[Tensor v a]
</span><a href="#local-6989586621679155916"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-260"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679155911"><span class="annot"><span class="annottext">types :: [DataType]
</span><a href="#local-6989586621679155911"><span class="hs-identifier hs-var hs-var">types</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; DataType -&gt; [DataType]
forall a. Int -&gt; a -&gt; [a]
</span><span class="hs-identifier hs-var">replicate</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Tensor v a] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><span class="hs-identifier hs-var">length</span></span><span> </span><span class="annot"><span class="annottext">[Tensor v a]
</span><a href="#local-6989586621679155916"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; DataType
forall a. TensorType a =&gt; a -&gt; DataType
</span><span class="hs-identifier hs-var">tensorType</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. HasCallStack =&gt; a
</span><span class="hs-identifier hs-var">undefined</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679155920"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-261"></span><span>    </span><span id="local-6989586621679155908"><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679155908"><span class="hs-identifier hs-var">names'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Tensor Build ByteString -&gt; Build [Output]
forall a. BuildInputs a =&gt; a -&gt; Build [Output]
</span><span class="hs-identifier hs-var">buildInputs</span></span><span> </span><span class="annot"><span class="annottext">(Tensor Build ByteString -&gt; Build [Output])
-&gt; Tensor Build ByteString -&gt; Build [Output]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">[Tensor Build ByteString] -&gt; Tensor Build ByteString
forall (v'1 :: * -&gt; *) t.
TensorType t =&gt;
[Tensor v'1 t] -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.pack</span></span><span> </span><span class="annot"><span class="annottext">[Tensor Build ByteString]
</span><a href="#local-6989586621679155912"><span class="hs-identifier hs-var">names</span></a></span><span>
</span><span id="line-262"></span><span>    </span><span id="local-6989586621679155906"><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679155906"><span class="hs-identifier hs-var">xs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Tensor v a] -&gt; Build [Output]
forall a. BuildInputs a =&gt; a -&gt; Build [Output]
</span><span class="hs-identifier hs-var">buildInputs</span></span><span> </span><span class="annot"><span class="annottext">[Tensor v a]
</span><a href="#local-6989586621679155916"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-263"></span><span>    </span><span id="local-6989586621679155905"><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679155905"><span class="hs-identifier hs-var">path'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Tensor Build ByteString -&gt; Build [Output]
forall a. BuildInputs a =&gt; a -&gt; Build [Output]
</span><span class="hs-identifier hs-var">buildInputs</span></span><span> </span><span class="annot"><span class="annottext">(Tensor Build ByteString -&gt; Build [Output])
-&gt; Tensor Build ByteString -&gt; Build [Output]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Tensor Build ByteString
forall a. TensorType a =&gt; a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#scalar"><span class="hs-identifier hs-var">scalar</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679155917"><span class="hs-identifier hs-var">path</span></a></span><span>
</span><span id="line-264"></span><span>    </span><span class="annot"><span class="annottext">[Int64] -&gt; OpDef -&gt; Build ControlNode
forall a. BuildResult a =&gt; [Int64] -&gt; OpDef -&gt; Build a
</span><span class="hs-identifier hs-var">buildOp</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(OpDef -&gt; Build ControlNode) -&gt; OpDef -&gt; Build ControlNode
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">OpType -&gt; OpDef
</span><span class="hs-identifier hs-var">opDef</span></span><span> </span><span class="annot"><span class="hs-string">&quot;Save&quot;</span></span><span>
</span><span id="line-265"></span><span>                    </span><span class="annot"><span class="annottext">OpDef -&gt; OpParams -&gt; OpDef
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Lens' OpDef [DataType]
forall a. Attribute a =&gt; Text -&gt; Lens' OpDef a
</span><span class="hs-identifier hs-var">opAttr</span></span><span> </span><span class="annot"><span class="hs-string">&quot;T&quot;</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef [DataType])
-&gt; [DataType] -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">[DataType]
</span><a href="#local-6989586621679155911"><span class="hs-identifier hs-var">types</span></a></span><span>
</span><span id="line-266"></span><span>                    </span><span class="annot"><span class="annottext">OpDef -&gt; OpParams -&gt; OpDef
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">Lens' OpDef [Output]
forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef [Output]
</span><span class="hs-identifier hs-var">opInputs</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef [Output])
-&gt; [Output] -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679155905"><span class="hs-identifier hs-var">path'</span></a></span><span> </span><span class="annot"><span class="annottext">[Output] -&gt; [Output] -&gt; [Output]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679155908"><span class="hs-identifier hs-var">names'</span></a></span><span> </span><span class="annot"><span class="annottext">[Output] -&gt; [Output] -&gt; [Output]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679155906"><span class="hs-identifier hs-var">xs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-267"></span><span>
</span><span id="line-268"></span><span class="hs-comment">-- | Restore a tensor's value from a checkpoint file.</span><span>
</span><span id="line-269"></span><span class="hs-comment">--</span><span>
</span><span id="line-270"></span><span class="hs-comment">-- This version allows restoring from a checkpoint file that uses a different</span><span>
</span><span id="line-271"></span><span class="hs-comment">-- tensor name than the variable.</span><span>
</span><span id="line-272"></span><span class="annot"><a href="TensorFlow.Ops.html#restoreFromName"><span class="hs-identifier hs-type">restoreFromName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679156199"><span class="annot"><a href="#local-6989586621679156199"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621679156200"><span class="annot"><a href="#local-6989586621679156200"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679156200"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156199"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-273"></span><span>                </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span>    </span><span class="hs-comment">-- ^ File path.</span><span>
</span><span id="line-274"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span>    </span><span class="hs-comment">-- ^ Tensor name override.</span><span>
</span><span id="line-275"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ref</span></span><span> </span><span class="annot"><a href="#local-6989586621679156199"><span class="hs-identifier hs-type">a</span></a></span><span>  </span><span class="hs-comment">-- ^ Tensor to restore.</span><span>
</span><span id="line-276"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679156200"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ControlNode</span></span><span>
</span><span id="line-277"></span><span id="restoreFromName"><span class="annot"><span class="annottext">restoreFromName :: ByteString -&gt; ByteString -&gt; Tensor Ref a -&gt; m ControlNode
</span><a href="TensorFlow.Ops.html#restoreFromName"><span class="hs-identifier hs-var hs-var">restoreFromName</span></a></span></span><span> </span><span id="local-6989586621679155903"><span class="annot"><span class="annottext">path :: ByteString
</span><a href="#local-6989586621679155903"><span class="hs-identifier hs-var">path</span></a></span></span><span> </span><span id="local-6989586621679155902"><span class="annot"><span class="annottext">name :: ByteString
</span><a href="#local-6989586621679155902"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span id="local-6989586621679155901"><span class="annot"><span class="annottext">x :: Tensor Ref a
</span><a href="#local-6989586621679155901"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Build ControlNode -&gt; m ControlNode
forall (m :: * -&gt; *) a. MonadBuild m =&gt; Build a -&gt; m a
</span><span class="hs-identifier hs-var">build</span></span><span> </span><span class="annot"><span class="annottext">(Build ControlNode -&gt; m ControlNode)
-&gt; Build ControlNode -&gt; m ControlNode
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-278"></span><span>    </span><span id="local-6989586621679155900"><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679155900"><span class="hs-identifier hs-var">path'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Tensor Build ByteString -&gt; Build [Output]
forall a. BuildInputs a =&gt; a -&gt; Build [Output]
</span><span class="hs-identifier hs-var">buildInputs</span></span><span> </span><span class="annot"><span class="annottext">(Tensor Build ByteString -&gt; Build [Output])
-&gt; Tensor Build ByteString -&gt; Build [Output]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Tensor Build ByteString
forall a. TensorType a =&gt; a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#scalar"><span class="hs-identifier hs-var">scalar</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679155903"><span class="hs-identifier hs-var">path</span></a></span><span>
</span><span id="line-279"></span><span>    </span><span id="local-6989586621679155899"><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679155899"><span class="hs-identifier hs-var">name'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Tensor Build ByteString -&gt; Build [Output]
forall a. BuildInputs a =&gt; a -&gt; Build [Output]
</span><span class="hs-identifier hs-var">buildInputs</span></span><span> </span><span class="annot"><span class="annottext">(Tensor Build ByteString -&gt; Build [Output])
-&gt; Tensor Build ByteString -&gt; Build [Output]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Tensor Build ByteString
forall a. TensorType a =&gt; a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#scalar"><span class="hs-identifier hs-var">scalar</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679155902"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-280"></span><span>    </span><span id="local-6989586621679155898"><span class="annot"><span class="annottext">Tensor Value a
</span><a href="#local-6989586621679155898"><span class="hs-identifier hs-var">restoreOp</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; OpDef -&gt; Build (Tensor Value a)
forall a. BuildResult a =&gt; [Int64] -&gt; OpDef -&gt; Build a
</span><span class="hs-identifier hs-var">buildOp</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(OpDef -&gt; Build (Tensor Value a))
-&gt; OpDef -&gt; Build (Tensor Value a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">OpType -&gt; OpDef
</span><span class="hs-identifier hs-var">opDef</span></span><span> </span><span class="annot"><span class="hs-string">&quot;Restore&quot;</span></span><span>
</span><span id="line-281"></span><span>                               </span><span class="annot"><span class="annottext">OpDef -&gt; OpParams -&gt; OpDef
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Lens' OpDef DataType
forall a. Attribute a =&gt; Text -&gt; Lens' OpDef a
</span><span class="hs-identifier hs-var">opAttr</span></span><span> </span><span class="annot"><span class="hs-string">&quot;dt&quot;</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef DataType)
-&gt; DataType -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; DataType
forall a. TensorType a =&gt; a -&gt; DataType
</span><span class="hs-identifier hs-var">tensorType</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. HasCallStack =&gt; a
</span><span class="hs-identifier hs-var">undefined</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679156199"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-282"></span><span>                               </span><span class="annot"><span class="annottext">OpDef -&gt; OpParams -&gt; OpDef
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">Lens' OpDef [Output]
forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef [Output]
</span><span class="hs-identifier hs-var">opInputs</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef [Output])
-&gt; [Output] -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679155900"><span class="hs-identifier hs-var">path'</span></a></span><span> </span><span class="annot"><span class="annottext">[Output] -&gt; [Output] -&gt; [Output]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679155899"><span class="hs-identifier hs-var">name'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-283"></span><span>    </span><span class="annot"><span class="annottext">Tensor Ref a -&gt; Build ControlNode
forall (m :: * -&gt; *) t.
(MonadBuild m, Nodes t) =&gt;
t -&gt; m ControlNode
</span><span class="hs-identifier hs-var">group</span></span><span> </span><span class="annot"><span class="annottext">(Tensor Ref a -&gt; Build ControlNode)
-&gt; BuildT Identity (Tensor Ref a) -&gt; Build ControlNode
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><span class="hs-operator hs-var">=&lt;&lt;</span></span><span> </span><span class="annot"><span class="annottext">Tensor Ref a -&gt; Tensor Value a -&gt; BuildT Identity (Tensor Ref a)
forall (v'2 :: * -&gt; *) t (m' :: * -&gt; *).
(MonadBuild m', TensorType t) =&gt;
Tensor Ref t -&gt; Tensor v'2 t -&gt; m' (Tensor Ref t)
</span><span class="hs-identifier hs-var">CoreOps.assign</span></span><span> </span><span class="annot"><span class="annottext">Tensor Ref a
</span><a href="#local-6989586621679155901"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tensor Value a
</span><a href="#local-6989586621679155898"><span class="hs-identifier hs-var">restoreOp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Value</span></span><span> </span><span class="annot"><a href="#local-6989586621679156199"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-284"></span><span>
</span><span id="line-285"></span><span class="hs-comment">-- | Restore a tensor's value from a checkpoint file.</span><span>
</span><span id="line-286"></span><span class="annot"><a href="TensorFlow.Ops.html#restore"><span class="hs-identifier hs-type">restore</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679155897"><span class="annot"><a href="#local-6989586621679155897"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621679155896"><span class="annot"><a href="#local-6989586621679155896"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679155896"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155897"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-287"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span>    </span><span class="hs-comment">-- ^ File path.</span><span>
</span><span id="line-288"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ref</span></span><span> </span><span class="annot"><a href="#local-6989586621679155897"><span class="hs-identifier hs-type">a</span></a></span><span>  </span><span class="hs-comment">-- ^ Tensor to restore.</span><span>
</span><span id="line-289"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679155896"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ControlNode</span></span><span>
</span><span id="line-290"></span><span id="restore"><span class="annot"><span class="annottext">restore :: ByteString -&gt; Tensor Ref a -&gt; m ControlNode
</span><a href="TensorFlow.Ops.html#restore"><span class="hs-identifier hs-var hs-var">restore</span></a></span></span><span> </span><span id="local-6989586621679155895"><span class="annot"><span class="annottext">path :: ByteString
</span><a href="#local-6989586621679155895"><span class="hs-identifier hs-var">path</span></a></span></span><span> </span><span id="local-6989586621679155894"><span class="annot"><span class="annottext">x :: Tensor Ref a
</span><a href="#local-6989586621679155894"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Tensor Ref a -&gt; m ControlNode
forall a (m :: * -&gt; *).
(MonadBuild m, TensorType a) =&gt;
ByteString -&gt; ByteString -&gt; Tensor Ref a -&gt; m ControlNode
</span><a href="TensorFlow.Ops.html#restoreFromName"><span class="hs-identifier hs-var">restoreFromName</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679155895"><span class="hs-identifier hs-var">path</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679155893"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Ref a
</span><a href="#local-6989586621679155894"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-291"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-292"></span><span>    </span><span id="local-6989586621679155893"><span class="annot"><span class="annottext">name :: ByteString
</span><a href="#local-6989586621679155893"><span class="hs-identifier hs-var hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; ByteString
</span><span class="hs-identifier hs-var">encodeUtf8</span></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; ByteString) -&gt; Text -&gt; ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Output -&gt; Text
</span><span class="hs-identifier hs-var">encodeOutput</span></span><span> </span><span class="annot"><span class="annottext">(Output -&gt; Text) -&gt; Output -&gt; Text
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Tensor Ref a -&gt; Output
forall (t :: * -&gt; *) a. Rendered t =&gt; t a -&gt; Output
</span><span class="hs-identifier hs-var">renderedOutput</span></span><span> </span><span class="annot"><span class="annottext">Tensor Ref a
</span><a href="#local-6989586621679155894"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-293"></span><span>
</span><span id="line-294"></span><span class="hs-comment">-- | Create a constant tensor.</span><span>
</span><span id="line-295"></span><span class="hs-comment">--</span><span>
</span><span id="line-296"></span><span class="hs-comment">-- The values should be in row major order, e.g.,</span><span>
</span><span id="line-297"></span><span class="hs-comment">--</span><span>
</span><span id="line-298"></span><span class="hs-comment">--   element 0:   index (0, ..., 0)</span><span>
</span><span id="line-299"></span><span class="hs-comment">--   element 1:   index (0, ..., 1)</span><span>
</span><span id="line-300"></span><span class="hs-comment">--   ...</span><span>
</span><span id="line-301"></span><span id="local-6989586621679155892"><span class="annot"><a href="TensorFlow.Ops.html#constant"><span class="hs-identifier hs-type">constant</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155892"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679155892"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679155892"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-302"></span><span id="constant"><span class="annot"><span class="annottext">constant :: Shape -&gt; [a] -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#constant"><span class="hs-identifier hs-var hs-var">constant</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Shape -&gt; [a] -&gt; Tensor Build a
forall a.
TensorType a =&gt;
OpParams -&gt; Shape -&gt; [a] -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#constant%27"><span class="hs-identifier hs-var">constant'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-303"></span><span>
</span><span id="line-304"></span><span class="annot"><a href="TensorFlow.Ops.html#constant%27"><span class="hs-identifier hs-type">constant'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679156197"><span class="annot"><a href="#local-6989586621679156197"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156197"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679156197"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679156197"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-305"></span><span id="constant%27"><span class="annot"><span class="annottext">constant' :: OpParams -&gt; Shape -&gt; [a] -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#constant%27"><span class="hs-identifier hs-var hs-var">constant'</span></a></span></span><span> </span><span id="local-6989586621679155891"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679155891"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span id="local-6989586621679155889"><span class="annot"><span class="annottext">cShape :: [Int64]
</span><a href="#local-6989586621679155889"><span class="hs-identifier hs-var">cShape</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679155888"><span class="annot"><span class="annottext">values :: [a]
</span><a href="#local-6989586621679155888"><span class="hs-identifier hs-var">values</span></a></span></span><span>
</span><span id="line-306"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679155887"><span class="hs-identifier hs-var">invalidLength</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Tensor Build a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679155885"><span class="hs-identifier hs-var">invalidLengthMsg</span></a></span><span>
</span><span id="line-307"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">otherwise</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor Build a
forall dtype. TensorType dtype =&gt; OpParams -&gt; Tensor Build dtype
</span><span class="hs-identifier hs-var">CoreOps.const'</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679155891"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; OpParams -&gt; OpParams
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Lens' OpDef TensorProto
forall a. Attribute a =&gt; Text -&gt; Lens' OpDef a
</span><span class="hs-identifier hs-var">opAttr</span></span><span> </span><span class="annot"><span class="hs-string">&quot;value&quot;</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 LensLike' f OpDef TensorProto)
-&gt; TensorProto -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">TensorProto
</span><a href="#local-6989586621679155883"><span class="hs-identifier hs-var">typedNode</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-308"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-309"></span><span>    </span><span id="local-6989586621679155887"><span class="annot"><span class="annottext">invalidLength :: Bool
</span><a href="#local-6989586621679155887"><span class="hs-identifier hs-var hs-var">invalidLength</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; Int64
forall (t :: * -&gt; *) a. (Foldable t, Num a) =&gt; t a -&gt; a
</span><span class="hs-identifier hs-var">product</span></span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679155889"><span class="hs-identifier hs-var">cShape</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><span class="hs-identifier hs-var">fromIntegral</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><span class="hs-identifier hs-var">length</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679155888"><span class="hs-identifier hs-var">values</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-310"></span><span>    </span><span id="local-6989586621679155885"><span class="annot"><span class="annottext">invalidLengthMsg :: [Char]
</span><a href="#local-6989586621679155885"><span class="hs-identifier hs-var hs-var">invalidLengthMsg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Int64 -&gt; Int -&gt; [Char]
forall r. PrintfType r =&gt; [Char] -&gt; r
</span><span class="hs-identifier hs-var">printf</span></span><span> </span><span class="annot"><span class="hs-string">&quot;invalid tensor length: expected %d got %d&quot;</span></span><span>
</span><span id="line-311"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Int64] -&gt; Int64
forall (t :: * -&gt; *) a. (Foldable t, Num a) =&gt; t a -&gt; a
</span><span class="hs-identifier hs-var">product</span></span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679155889"><span class="hs-identifier hs-var">cShape</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-312"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><span class="hs-identifier hs-var">length</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679155888"><span class="hs-identifier hs-var">values</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-313"></span><span>    </span><span class="annot"><a href="#local-6989586621679155883"><span class="hs-identifier hs-type">typedNode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorProto</span></span><span>
</span><span id="line-314"></span><span>    </span><span id="local-6989586621679155883"><span class="annot"><span class="annottext">typedNode :: TensorProto
</span><a href="#local-6989586621679155883"><span class="hs-identifier hs-var hs-var">typedNode</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorProto
forall a. Message a =&gt; a
</span><span class="hs-identifier hs-var">def</span></span><span>
</span><span id="line-315"></span><span>                </span><span class="annot"><span class="annottext">TensorProto -&gt; (TensorProto -&gt; TensorProto) -&gt; TensorProto
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">forall (f :: * -&gt; *).
Identical f =&gt;
LensLike' f TensorProto DataType
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;dtype&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">dtype</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 LensLike' f TensorProto DataType)
-&gt; DataType -&gt; TensorProto -&gt; TensorProto
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; DataType
forall a. TensorType a =&gt; a -&gt; DataType
</span><span class="hs-identifier hs-var">tensorType</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. HasCallStack =&gt; a
</span><span class="hs-identifier hs-var">undefined</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679156197"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-316"></span><span>                </span><span class="annot"><span class="annottext">TensorProto -&gt; (TensorProto -&gt; TensorProto) -&gt; TensorProto
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto TensorShapeProto
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;tensorShape&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">tensorShape</span></span><span class="annot"><span class="annottext">LensLike' f TensorProto TensorShapeProto
-&gt; (([TensorShapeProto'Dim] -&gt; f [TensorShapeProto'Dim])
    -&gt; TensorShapeProto -&gt; f TensorShapeProto)
-&gt; ([TensorShapeProto'Dim] -&gt; f [TensorShapeProto'Dim])
-&gt; TensorProto
-&gt; f TensorProto
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span class="annot"><span class="annottext">([TensorShapeProto'Dim] -&gt; f [TensorShapeProto'Dim])
-&gt; TensorShapeProto -&gt; f TensorShapeProto
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;dim&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">TensorShape.dim</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 ([TensorShapeProto'Dim] -&gt; f [TensorShapeProto'Dim])
 -&gt; TensorProto -&gt; f TensorProto)
-&gt; [TensorShapeProto'Dim] -&gt; TensorProto -&gt; TensorProto
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span>
</span><span id="line-317"></span><span>                      </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TensorShapeProto'Dim
forall a. Message a =&gt; a
</span><span class="hs-identifier hs-var">def</span></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto'Dim
-&gt; (TensorShapeProto'Dim -&gt; TensorShapeProto'Dim)
-&gt; TensorShapeProto'Dim
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">forall (f :: * -&gt; *).
Identical f =&gt;
LensLike' f TensorShapeProto'Dim Int64
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;size&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">TensorShape.size</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 LensLike' f TensorShapeProto'Dim Int64)
-&gt; Int64 -&gt; TensorShapeProto'Dim -&gt; TensorShapeProto'Dim
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679155878"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679155878"><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679155878"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679155889"><span class="hs-identifier hs-var">cShape</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-318"></span><span>                </span><span class="annot"><span class="annottext">TensorProto -&gt; (TensorProto -&gt; TensorProto) -&gt; TensorProto
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">forall a. TensorType a =&gt; Lens' TensorProto [a]
forall (f :: * -&gt; *). Identical f =&gt; LensLike' f TensorProto [a]
</span><span class="hs-identifier hs-var">tensorVal</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *). Identical f =&gt; LensLike' f TensorProto [a])
-&gt; [a] -&gt; TensorProto -&gt; TensorProto
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679155888"><span class="hs-identifier hs-var">values</span></a></span><span>
</span><span id="line-319"></span><span>
</span><span id="line-320"></span><span class="hs-comment">-- | Reshape a N-D tensor down to a scalar.</span><span>
</span><span id="line-321"></span><span class="hs-comment">--</span><span>
</span><span id="line-322"></span><span class="hs-comment">-- See `TensorFlow.GenOps.Core.reshape`.</span><span>
</span><span id="line-323"></span><span id="local-6989586621679155875"><span id="local-6989586621679155876"><span class="annot"><a href="TensorFlow.Ops.html#scalarize"><span class="hs-identifier hs-type">scalarize</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155876"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155875"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155876"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679155876"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-324"></span><span id="scalarize"><span class="annot"><span class="annottext">scalarize :: Tensor v a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#scalarize"><span class="hs-identifier hs-var hs-var">scalarize</span></a></span></span><span> </span><span id="local-6989586621679155874"><span class="annot"><span class="annottext">t :: Tensor v a
</span><a href="#local-6989586621679155874"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor Build Int32 -&gt; Tensor Build a
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t tshape.
(TensorType t, OneOf '[Int32, Int64] tshape) =&gt;
Tensor v'1 t -&gt; Tensor v'2 tshape -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.reshape</span></span><span> </span><span class="annot"><span class="annottext">Tensor v a
</span><a href="#local-6989586621679155874"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Int32] -&gt; Tensor Build Int32
forall a. TensorType a =&gt; [a] -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#vector"><span class="hs-identifier hs-var">vector</span></a></span><span> </span><span class="annot"><span class="annottext">[Int32]
</span><a href="#local-6989586621679155873"><span class="hs-identifier hs-var">scalarShape</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-325"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-326"></span><span>        </span><span id="local-6989586621679155873"><span class="annot"><span class="annottext">scalarShape :: [Int32]
</span><a href="#local-6989586621679155873"><span class="hs-identifier hs-var hs-var">scalarShape</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span class="hs-special">]</span><span>
</span><span id="line-327"></span><span>
</span><span id="line-328"></span><span class="hs-comment">-- | Sum a tensor down to a scalar</span><span>
</span><span id="line-329"></span><span class="hs-comment">-- Seee `TensorFlow.GenOps.Core.sum`</span><span>
</span><span id="line-330"></span><span id="local-6989586621679155871"><span id="local-6989586621679155872"><span class="annot"><a href="TensorFlow.Ops.html#reduceSum"><span class="hs-identifier hs-type">reduceSum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">OneOf</span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span>
</span><span id="line-331"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">]</span><span> </span><span class="annot"><a href="#local-6989586621679155872"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
</span><span id="line-332"></span><span>             </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155871"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155872"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679155872"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-333"></span><span id="reduceSum"><span class="annot"><span class="annottext">reduceSum :: Tensor v a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#reduceSum"><span class="hs-identifier hs-var hs-var">reduceSum</span></a></span></span><span> </span><span id="local-6989586621679155870"><span class="annot"><span class="annottext">x :: Tensor v a
</span><a href="#local-6989586621679155870"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor Build Int32 -&gt; Tensor Build a
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t tidx.
(OneOf
   '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16,
     Word32, Word64, Word8, Double, Float]
   t,
 OneOf '[Int32, Int64] tidx) =&gt;
Tensor v'1 t -&gt; Tensor v'2 tidx -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.sum</span></span><span> </span><span class="annot"><span class="annottext">Tensor v a
</span><a href="#local-6989586621679155870"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
</span><a href="#local-6989586621679155869"><span class="hs-identifier hs-var">allAxes</span></a></span><span>
</span><span id="line-334"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679155869"><span class="annot"><span class="annottext">allAxes :: Tensor Build Int32
</span><a href="#local-6989586621679155869"><span class="hs-identifier hs-var hs-var">allAxes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
-&gt; Tensor Build Int32 -&gt; Tensor Build Int32 -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) (v'3 :: * -&gt; *) tidx.
OneOf '[Int32, Int64, Word16, Double, Float] tidx =&gt;
Tensor v'1 tidx
-&gt; Tensor v'2 tidx -&gt; Tensor v'3 tidx -&gt; Tensor Build tidx
</span><span class="hs-identifier hs-var">CoreOps.range</span></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) t.
TensorType t =&gt;
Tensor v'1 t -&gt; Tensor Build Int32
</span><span class="hs-identifier hs-var">CoreOps.rank</span></span><span> </span><span class="annot"><span class="annottext">Tensor v a
</span><a href="#local-6989586621679155870"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-number">1</span></span><span>
</span><span id="line-335"></span><span>
</span><span id="line-336"></span><span id="local-6989586621679155866"><span id="local-6989586621679155867"><span class="annot"><a href="TensorFlow.Ops.html#reduceSum%27"><span class="hs-identifier hs-type">reduceSum'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">OneOf</span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span>
</span><span id="line-337"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">]</span><span> </span><span class="annot"><a href="#local-6989586621679155867"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
</span><span id="line-338"></span><span>              </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155866"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155867"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679155867"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-339"></span><span id="reduceSum%27"><span class="annot"><span class="annottext">reduceSum' :: OpParams -&gt; Tensor v a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#reduceSum%27"><span class="hs-identifier hs-var hs-var">reduceSum'</span></a></span></span><span> </span><span id="local-6989586621679155865"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679155865"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span id="local-6989586621679155864"><span class="annot"><span class="annottext">x :: Tensor v a
</span><a href="#local-6989586621679155864"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor v a -&gt; Tensor Build Int32 -&gt; Tensor Build a
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t tidx.
(OneOf
   '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16,
     Word32, Word64, Word8, Double, Float]
   t,
 OneOf '[Int32, Int64] tidx) =&gt;
OpParams -&gt; Tensor v'1 t -&gt; Tensor v'2 tidx -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.sum'</span></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679155865"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor v a
</span><a href="#local-6989586621679155864"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
</span><a href="#local-6989586621679155863"><span class="hs-identifier hs-var">allAxes</span></a></span><span>
</span><span id="line-340"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679155863"><span class="annot"><span class="annottext">allAxes :: Tensor Build Int32
</span><a href="#local-6989586621679155863"><span class="hs-identifier hs-var hs-var">allAxes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
-&gt; Tensor Build Int32 -&gt; Tensor Build Int32 -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) (v'3 :: * -&gt; *) tidx.
OneOf '[Int32, Int64, Word16, Double, Float] tidx =&gt;
Tensor v'1 tidx
-&gt; Tensor v'2 tidx -&gt; Tensor v'3 tidx -&gt; Tensor Build tidx
</span><span class="hs-identifier hs-var">CoreOps.range</span></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) t.
TensorType t =&gt;
Tensor v'1 t -&gt; Tensor Build Int32
</span><span class="hs-identifier hs-var">CoreOps.rank</span></span><span> </span><span class="annot"><span class="annottext">Tensor v a
</span><a href="#local-6989586621679155864"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-number">1</span></span><span>
</span><span id="line-341"></span><span>
</span><span id="line-342"></span><span class="hs-comment">-- | Computes the mean of elements across dimensions of a tensor.</span><span>
</span><span id="line-343"></span><span class="hs-comment">-- See `TensorFlow.GenOps.Core.mean`</span><span>
</span><span id="line-344"></span><span id="local-6989586621679155861"><span id="local-6989586621679155862"><span class="annot"><a href="TensorFlow.Ops.html#reduceMean"><span class="hs-identifier hs-type">reduceMean</span></a></span><span>
</span><span id="line-345"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155862"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-346"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OneOf</span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">]</span><span> </span><span class="annot"><a href="#local-6989586621679155862"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-347"></span><span>     </span><span class="hs-special">)</span><span>
</span><span id="line-348"></span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155861"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155862"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679155862"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-349"></span><span id="reduceMean"><span class="annot"><span class="annottext">reduceMean :: Tensor v a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#reduceMean"><span class="hs-identifier hs-var hs-var">reduceMean</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor v a -&gt; Tensor Build a
forall a (v :: * -&gt; *).
(TensorType a,
 OneOf '[Double, Float, Complex Float, Complex Double] a) =&gt;
OpParams -&gt; Tensor v a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#reduceMean%27"><span class="hs-identifier hs-var">reduceMean'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-350"></span><span>
</span><span id="line-351"></span><span id="local-6989586621679156136"><span id="local-6989586621679156137"><span class="annot"><a href="TensorFlow.Ops.html#reduceMean%27"><span class="hs-identifier hs-type">reduceMean'</span></a></span><span>
</span><span id="line-352"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156137"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-353"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OneOf</span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">]</span><span> </span><span class="annot"><a href="#local-6989586621679156137"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-354"></span><span>     </span><span class="hs-special">)</span><span>
</span><span id="line-355"></span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679156136"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679156137"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679156137"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-356"></span><span id="reduceMean%27"><span class="annot"><span class="annottext">reduceMean' :: OpParams -&gt; Tensor v a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#reduceMean%27"><span class="hs-identifier hs-var hs-var">reduceMean'</span></a></span></span><span> </span><span id="local-6989586621679155860"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679155860"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span id="local-6989586621679155859"><span class="annot"><span class="annottext">x :: Tensor v a
</span><a href="#local-6989586621679155859"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor v a -&gt; Tensor Build Int32 -&gt; Tensor Build a
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t tidx.
(OneOf
   '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16,
     Word32, Word64, Word8, Double, Float]
   t,
 OneOf '[Int32, Int64] tidx) =&gt;
OpParams -&gt; Tensor v'1 t -&gt; Tensor v'2 tidx -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.mean'</span></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679155860"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor v a
</span><a href="#local-6989586621679155859"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
</span><a href="#local-6989586621679155858"><span class="hs-identifier hs-var">allAxes</span></a></span><span>
</span><span id="line-357"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679155858"><span class="annot"><span class="annottext">allAxes :: Tensor Build Int32
</span><a href="#local-6989586621679155858"><span class="hs-identifier hs-var hs-var">allAxes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
-&gt; Tensor Build Int32 -&gt; Tensor Build Int32 -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) (v'3 :: * -&gt; *) tidx.
OneOf '[Int32, Int64, Word16, Double, Float] tidx =&gt;
Tensor v'1 tidx
-&gt; Tensor v'2 tidx -&gt; Tensor v'3 tidx -&gt; Tensor Build tidx
</span><span class="hs-identifier hs-var">CoreOps.range</span></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tensor v a -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) t.
TensorType t =&gt;
Tensor v'1 t -&gt; Tensor Build Int32
</span><span class="hs-identifier hs-var">CoreOps.rank</span></span><span> </span><span class="annot"><span class="annottext">Tensor v a
</span><a href="#local-6989586621679155859"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-number">1</span></span><span>
</span><span id="line-358"></span><span>
</span><span id="line-359"></span><span class="hs-comment">-- | Create a constant vector.</span><span>
</span><span id="line-360"></span><span id="local-6989586621679156303"><span class="annot"><a href="TensorFlow.Ops.html#vector"><span class="hs-identifier hs-type">vector</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156303"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679156303"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679156303"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-361"></span><span id="vector"><span class="annot"><span class="annottext">vector :: [a] -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#vector"><span class="hs-identifier hs-var hs-var">vector</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; [a] -&gt; Tensor Build a
forall a. TensorType a =&gt; OpParams -&gt; [a] -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#vector%27"><span class="hs-identifier hs-var">vector'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span id="local-6989586621679156132"><span class="annot"><a href="TensorFlow.Ops.html#vector%27"><span class="hs-identifier hs-type">vector'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156132"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679156132"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679156132"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-364"></span><span id="vector%27"><span class="annot"><span class="annottext">vector' :: OpParams -&gt; [a] -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#vector%27"><span class="hs-identifier hs-var hs-var">vector'</span></a></span></span><span> </span><span id="local-6989586621679155857"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679155857"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span id="local-6989586621679155856"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621679155856"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Shape -&gt; [a] -&gt; Tensor Build a
forall a.
TensorType a =&gt;
OpParams -&gt; Shape -&gt; [a] -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#constant%27"><span class="hs-identifier hs-var">constant'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679155857"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int -&gt; Item Shape
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><span class="hs-identifier hs-var">fromIntegral</span></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Item Shape) -&gt; Int -&gt; Item Shape
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><span class="hs-identifier hs-var">length</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679155856"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679155856"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-365"></span><span>
</span><span id="line-366"></span><span class="hs-comment">-- | Create a constant scalar.</span><span>
</span><span id="line-367"></span><span id="local-6989586621679156326"><span class="annot"><a href="TensorFlow.Ops.html#scalar"><span class="hs-identifier hs-type">scalar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156326"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679156326"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679156326"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-368"></span><span id="scalar"><span class="annot"><span class="annottext">scalar :: a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#scalar"><span class="hs-identifier hs-var hs-var">scalar</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; a -&gt; Tensor Build a
forall a. TensorType a =&gt; OpParams -&gt; a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#scalar%27"><span class="hs-identifier hs-var">scalar'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-369"></span><span>
</span><span id="line-370"></span><span id="local-6989586621679156129"><span class="annot"><a href="TensorFlow.Ops.html#scalar%27"><span class="hs-identifier hs-type">scalar'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156129"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679156129"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679156129"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-371"></span><span id="scalar%27"><span class="annot"><span class="annottext">scalar' :: OpParams -&gt; a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#scalar%27"><span class="hs-identifier hs-var hs-var">scalar'</span></a></span></span><span> </span><span id="local-6989586621679155855"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679155855"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span id="local-6989586621679155854"><span class="annot"><span class="annottext">x :: a
</span><a href="#local-6989586621679155854"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Shape -&gt; [a] -&gt; Tensor Build a
forall a.
TensorType a =&gt;
OpParams -&gt; Shape -&gt; [a] -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#constant%27"><span class="hs-identifier hs-var">constant'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679155855"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
Item [a]
</span><a href="#local-6989586621679155854"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-372"></span><span>
</span><span id="line-373"></span><span class="hs-comment">-- | Random tensor from the unit normal distribution with bounded values.</span><span>
</span><span id="line-374"></span><span class="hs-comment">--</span><span>
</span><span id="line-375"></span><span class="hs-comment">-- This is a type-restricted version of 'TensorFlow.GenOps.Core.truncatedNormal'.</span><span>
</span><span id="line-376"></span><span id="local-6989586621679155851"><span id="local-6989586621679155852"><span id="local-6989586621679155853"><span class="annot"><a href="TensorFlow.Ops.html#truncatedNormal"><span class="hs-identifier hs-type">truncatedNormal</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679155853"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OneOf</span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Word16</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">]</span><span> </span><span class="annot"><a href="#local-6989586621679155852"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-377"></span><span>                </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155851"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span>  </span><span class="hs-comment">-- ^ Shape.</span><span>
</span><span id="line-378"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679155853"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Value</span></span><span> </span><span class="annot"><a href="#local-6989586621679155852"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-379"></span><span id="truncatedNormal"><span class="annot"><span class="annottext">truncatedNormal :: Tensor v Int64 -&gt; m (Tensor Value a)
</span><a href="TensorFlow.Ops.html#truncatedNormal"><span class="hs-identifier hs-var hs-var">truncatedNormal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v Int64 -&gt; m (Tensor Value a)
forall (v'1 :: * -&gt; *) dtype t (m' :: * -&gt; *).
(MonadBuild m', OneOf '[Word16, Double, Float] dtype,
 OneOf '[Int32, Int64] t) =&gt;
Tensor v'1 t -&gt; m' (Tensor Value dtype)
</span><span class="hs-identifier hs-var">CoreOps.truncatedNormal</span></span><span>
</span><span id="line-380"></span><span>
</span><span id="line-381"></span><span id="local-6989586621679155847"><span id="local-6989586621679155848"><span id="local-6989586621679155849"><span class="annot"><a href="TensorFlow.Ops.html#truncatedNormal%27"><span class="hs-identifier hs-type">truncatedNormal'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679155849"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OneOf</span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Word16</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">]</span><span> </span><span class="annot"><a href="#local-6989586621679155848"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-382"></span><span>                </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155847"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span>  </span><span class="hs-comment">-- ^ Shape.</span><span>
</span><span id="line-383"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679155849"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Value</span></span><span> </span><span class="annot"><a href="#local-6989586621679155848"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-384"></span><span id="truncatedNormal%27"><span class="annot"><span class="annottext">truncatedNormal' :: OpParams -&gt; Tensor v Int64 -&gt; m (Tensor Value a)
</span><a href="TensorFlow.Ops.html#truncatedNormal%27"><span class="hs-identifier hs-var hs-var">truncatedNormal'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor v Int64 -&gt; m (Tensor Value a)
forall (v'1 :: * -&gt; *) dtype t (m' :: * -&gt; *).
(MonadBuild m', OneOf '[Word16, Double, Float] dtype,
 OneOf '[Int32, Int64] t) =&gt;
OpParams -&gt; Tensor v'1 t -&gt; m' (Tensor Value dtype)
</span><span class="hs-identifier hs-var">CoreOps.truncatedNormal'</span></span><span>
</span><span id="line-385"></span><span>
</span><span id="line-386"></span><span class="annot"><a href="TensorFlow.Ops.html#zeros"><span class="hs-identifier hs-type">zeros</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679156231"><span class="annot"><a href="#local-6989586621679156231"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Num</span></span><span> </span><span class="annot"><a href="#local-6989586621679156231"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679156231"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679156231"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-387"></span><span id="zeros"><span class="annot"><span class="annottext">zeros :: Shape -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#zeros"><span class="hs-identifier hs-var hs-var">zeros</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span id="local-6989586621679155845"><span class="annot"><span class="annottext">s :: [Int64]
</span><a href="#local-6989586621679155845"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor Build Int64 -&gt; Tensor Build a -&gt; Tensor Build a
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t index_type.
(TensorType t, OneOf '[Int32, Int64] index_type) =&gt;
Tensor v'1 index_type -&gt; Tensor v'2 t -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.fill</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Int64] -&gt; Tensor Build Int64
forall a. TensorType a =&gt; [a] -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#vector"><span class="hs-identifier hs-var">vector</span></a></span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679155845"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Tensor Build a
forall a. TensorType a =&gt; a -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#scalar"><span class="hs-identifier hs-var">scalar</span></a></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span class="hs-special">)</span><span>
</span><span id="line-388"></span><span>
</span><span id="line-389"></span><span id="local-6989586621679155843"><span id="local-6989586621679155844"><span class="annot"><a href="TensorFlow.Ops.html#shape"><span class="hs-identifier hs-type">shape</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155843"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span></span></span><span>
</span><span id="line-390"></span><span id="shape"><span class="annot"><span class="annottext">shape :: Tensor v t -&gt; Tensor Build Int32
</span><a href="TensorFlow.Ops.html#shape"><span class="hs-identifier hs-var hs-var">shape</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v t -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) t out_type.
(TensorType t, OneOf '[Int32, Int64] out_type) =&gt;
Tensor v'1 t -&gt; Tensor Build out_type
</span><span class="hs-identifier hs-var">CoreOps.shape</span></span><span>
</span><span id="line-391"></span><span>
</span><span id="line-392"></span><span id="local-6989586621679155840"><span id="local-6989586621679155841"><span class="annot"><a href="TensorFlow.Ops.html#shape%27"><span class="hs-identifier hs-type">shape'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155841"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155840"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155841"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span></span></span><span>
</span><span id="line-393"></span><span id="shape%27"><span class="annot"><span class="annottext">shape' :: OpParams -&gt; Tensor v t -&gt; Tensor Build Int32
</span><a href="TensorFlow.Ops.html#shape%27"><span class="hs-identifier hs-var hs-var">shape'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor v t -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) t out_type.
(TensorType t, OneOf '[Int32, Int64] out_type) =&gt;
OpParams -&gt; Tensor v'1 t -&gt; Tensor Build out_type
</span><span class="hs-identifier hs-var">CoreOps.shape'</span></span><span>
</span><span id="line-394"></span><span>
</span><span id="line-395"></span><span id="local-6989586621679155836"><span id="local-6989586621679155837"><span id="local-6989586621679155838"><span class="annot"><a href="TensorFlow.Ops.html#expandDims"><span class="hs-identifier hs-type">expandDims</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155838"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155837"><span class="hs-identifier hs-type">v1</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155838"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155836"><span class="hs-identifier hs-type">v2</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679155838"><span class="hs-identifier hs-type">t</span></a></span></span></span></span><span>
</span><span id="line-396"></span><span id="expandDims"><span class="annot"><span class="annottext">expandDims :: Tensor v1 t -&gt; Tensor v2 Int32 -&gt; Tensor Build t
</span><a href="TensorFlow.Ops.html#expandDims"><span class="hs-identifier hs-var hs-var">expandDims</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v1 t -&gt; Tensor v2 Int32 -&gt; Tensor Build t
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t tshape.
(TensorType t, OneOf '[Int32, Int64] tshape) =&gt;
Tensor v'1 t -&gt; Tensor v'2 tshape -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.expandDims</span></span><span>
</span><span id="line-397"></span><span>
</span><span id="line-398"></span><span id="local-6989586621679155832"><span id="local-6989586621679155833"><span id="local-6989586621679155834"><span class="annot"><a href="TensorFlow.Ops.html#expandDims%27"><span class="hs-identifier hs-type">expandDims'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679155834"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155833"><span class="hs-identifier hs-type">v1</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155834"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155832"><span class="hs-identifier hs-type">v2</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679155834"><span class="hs-identifier hs-type">t</span></a></span></span></span></span><span>
</span><span id="line-399"></span><span id="expandDims%27"><span class="annot"><span class="annottext">expandDims' :: OpParams -&gt; Tensor v1 t -&gt; Tensor v2 Int32 -&gt; Tensor Build t
</span><a href="TensorFlow.Ops.html#expandDims%27"><span class="hs-identifier hs-var hs-var">expandDims'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor v1 t -&gt; Tensor v2 Int32 -&gt; Tensor Build t
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t tperm.
(TensorType t, OneOf '[Int32, Int64] tperm) =&gt;
OpParams -&gt; Tensor v'1 t -&gt; Tensor v'2 tperm -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.expandDims'</span></span><span>
</span><span id="line-400"></span><span>
</span><span id="line-401"></span><span class="hs-comment">-- | Helper function for reduction ops (translation of math_ops.reduced_shape).</span><span>
</span><span id="line-402"></span><span id="local-6989586621679155827"><span id="local-6989586621679155828"><span id="local-6989586621679155829"><span id="local-6989586621679155830"><span class="annot"><a href="TensorFlow.Ops.html#reducedShape"><span class="hs-identifier hs-type">reducedShape</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">OneOf</span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span> </span><span class="hs-special">]</span><span> </span><span class="annot"><a href="#local-6989586621679155830"><span class="hs-identifier hs-type">t1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OneOf</span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span> </span><span class="hs-special">]</span><span> </span><span class="annot"><a href="#local-6989586621679155829"><span class="hs-identifier hs-type">t2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
</span><span id="line-403"></span><span>                </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155828"><span class="hs-identifier hs-type">v1</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155830"><span class="hs-identifier hs-type">t1</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679155827"><span class="hs-identifier hs-type">v2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679155829"><span class="hs-identifier hs-type">t2</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span></span></span></span></span><span>
</span><span id="line-404"></span><span id="reducedShape"><span class="annot"><span class="annottext">reducedShape :: Tensor v1 t1 -&gt; Tensor v2 t2 -&gt; Tensor Build Int32
</span><a href="TensorFlow.Ops.html#reducedShape"><span class="hs-identifier hs-var hs-var">reducedShape</span></a></span></span><span> </span><span id="local-6989586621679155826"><span class="annot"><span class="annottext">inputShape :: Tensor v1 t1
</span><a href="#local-6989586621679155826"><span class="hs-identifier hs-var">inputShape</span></a></span></span><span> </span><span id="local-6989586621679155825"><span class="annot"><span class="annottext">axes :: Tensor v2 t2
</span><a href="#local-6989586621679155825"><span class="hs-identifier hs-var">axes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-405"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679155824"><span class="annot"><span class="annottext">inputShape32 :: Tensor Build Int32
</span><a href="#local-6989586621679155824"><span class="hs-identifier hs-var hs-var">inputShape32</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v1 t1 -&gt; Tensor Build Int32
forall srcT (v'1 :: * -&gt; *).
TensorType srcT =&gt;
Tensor v'1 srcT -&gt; Tensor Build Int32
</span><a href="#local-6989586621679155823"><span class="hs-identifier hs-var">toInt32</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor v1 t1
</span><a href="#local-6989586621679155826"><span class="hs-identifier hs-var">inputShape</span></a></span><span>         </span><span class="hs-comment">-- [2, 3, 5, 7]</span><span>
</span><span id="line-406"></span><span>        </span><span id="local-6989586621679155822"><span class="annot"><span class="annottext">axes32 :: Tensor Build Int32
</span><a href="#local-6989586621679155822"><span class="hs-identifier hs-var hs-var">axes32</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v2 t2 -&gt; Tensor Build Int32
forall srcT (v'1 :: * -&gt; *).
TensorType srcT =&gt;
Tensor v'1 srcT -&gt; Tensor Build Int32
</span><a href="#local-6989586621679155823"><span class="hs-identifier hs-var">toInt32</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor v2 t2
</span><a href="#local-6989586621679155825"><span class="hs-identifier hs-var">axes</span></a></span><span>                     </span><span class="hs-comment">-- [1, 2]</span><span>
</span><span id="line-407"></span><span>        </span><span id="local-6989586621679155823"><span class="annot"><span class="annottext">toInt32 :: Tensor v'1 srcT -&gt; Tensor Build Int32
</span><a href="#local-6989586621679155823"><span class="hs-identifier hs-var hs-var">toInt32</span></a></span></span><span> </span><span id="local-6989586621679155821"><span class="annot"><span class="annottext">x :: Tensor v'1 srcT
</span><a href="#local-6989586621679155821"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor v'1 srcT -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) srcT dstT.
(TensorType srcT, TensorType dstT) =&gt;
Tensor v'1 srcT -&gt; Tensor Build dstT
</span><span class="hs-identifier hs-var">CoreOps.cast</span></span><span> </span><span class="annot"><span class="annottext">Tensor v'1 srcT
</span><a href="#local-6989586621679155821"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span>
</span><span id="line-408"></span><span>        </span><span id="local-6989586621679155820"><span class="annot"><span class="annottext">inputRank :: Tensor Build Int32
</span><a href="#local-6989586621679155820"><span class="hs-identifier hs-var hs-var">inputRank</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32 -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) t out_type.
(TensorType t, OneOf '[Int32, Int64] out_type) =&gt;
Tensor v'1 t -&gt; Tensor Build out_type
</span><span class="hs-identifier hs-var">CoreOps.size</span></span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
</span><a href="#local-6989586621679155824"><span class="hs-identifier hs-var">inputShape32</span></a></span><span>     </span><span class="hs-comment">-- 4</span><span>
</span><span id="line-409"></span><span>        </span><span id="local-6989586621679155819"><span class="annot"><span class="annottext">axesMod :: Tensor Build Int32
</span><a href="#local-6989586621679155819"><span class="hs-identifier hs-var hs-var">axesMod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tensor Build Int32
</span><a href="#local-6989586621679155822"><span class="hs-identifier hs-var">axes32</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32 -&gt; Tensor Build Int32 -&gt; Tensor Build Int32
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">+</span></span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
</span><a href="#local-6989586621679155820"><span class="hs-identifier hs-var">inputRank</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32 -&gt; Tensor Build Int32 -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t.
OneOf '[Int32, Int64, Word16, Double, Float] t =&gt;
Tensor v'1 t -&gt; Tensor v'2 t -&gt; Tensor Build t
</span><span class="hs-operator hs-var">`CoreOps.mod`</span></span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
</span><a href="#local-6989586621679155820"><span class="hs-identifier hs-var">inputRank</span></a></span><span>
</span><span id="line-410"></span><span>        </span><span id="local-6989586621679155817"><span class="annot"><span class="annottext">axesShape :: Tensor Build Int32
</span><a href="#local-6989586621679155817"><span class="hs-identifier hs-var hs-var">axesShape</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32 -&gt; Tensor Build Int32
forall srcT (v'1 :: * -&gt; *).
TensorType srcT =&gt;
Tensor v'1 srcT -&gt; Tensor Build Int32
</span><a href="TensorFlow.Ops.html#shape"><span class="hs-identifier hs-var">shape</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
</span><a href="#local-6989586621679155819"><span class="hs-identifier hs-var">axesMod</span></a></span><span>                 </span><span class="hs-comment">-- [2]</span><span>
</span><span id="line-411"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">[Tensor Build Int32] -&gt; [Tensor Build Int32] -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t.
TensorType t =&gt;
[Tensor v'1 Int32] -&gt; [Tensor v'2 t] -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.dynamicStitch</span></span><span>                      </span><span class="hs-comment">-- [2, 1, 1, 7]</span><span>
</span><span id="line-412"></span><span>         </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Tensor Build Int32
-&gt; Tensor Build Int32 -&gt; Tensor Build Int32 -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) (v'3 :: * -&gt; *) tidx.
OneOf '[Int32, Int64, Word16, Double, Float] tidx =&gt;
Tensor v'1 tidx
-&gt; Tensor v'2 tidx -&gt; Tensor v'3 tidx -&gt; Tensor Build tidx
</span><span class="hs-identifier hs-var">CoreOps.range</span></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
</span><a href="#local-6989586621679155820"><span class="hs-identifier hs-var">inputRank</span></a></span><span> </span><span class="annot"><span class="hs-number">1</span></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- [0, 1, 2, 3]</span><span>
</span><span id="line-413"></span><span>           </span><span class="annot"><span class="annottext">Item [Tensor Build Int32]
Tensor Build Int32
</span><a href="#local-6989586621679155819"><span class="hs-identifier hs-var">axesMod</span></a></span><span class="hs-special">]</span><span>                               </span><span class="hs-comment">-- [1, 2]</span><span>
</span><span id="line-414"></span><span>         </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Item [Tensor Build Int32]
Tensor Build Int32
</span><a href="#local-6989586621679155824"><span class="hs-identifier hs-var">inputShape32</span></a></span><span class="hs-special">,</span><span>                           </span><span class="hs-comment">-- [2, 3, 5, 7]</span><span>
</span><span id="line-415"></span><span>           </span><span class="annot"><span class="annottext">Tensor Build Int32 -&gt; Tensor Build Int32 -&gt; Tensor Build Int32
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) t index_type.
(TensorType t, OneOf '[Int32, Int64] index_type) =&gt;
Tensor v'1 index_type -&gt; Tensor v'2 t -&gt; Tensor Build t
</span><span class="hs-identifier hs-var">CoreOps.fill</span></span><span> </span><span class="annot"><span class="annottext">Tensor Build Int32
</span><a href="#local-6989586621679155817"><span class="hs-identifier hs-var">axesShape</span></a></span><span> </span><span class="annot"><span class="hs-number">1</span></span><span class="hs-special">]</span><span>              </span><span class="hs-comment">-- [1, 1]</span><span>
</span><span id="line-416"></span></pre></body></html>